
<template>
  <div id="app" v-bind:style="appDivStyle">
    <div class="context" ref="context">
      <div class="queryBox" ref="queryBox">
        <el-form :model="formQueryCondition" ref="form" size="mini">
          <!--查询条件-->
          <el-row>
            <el-col :span="7">
              <!-- 演员编号 -->
              <el-form-item :label="$t('Actor.queryLabel.code')" :label-width="queryformLabelWidth">
                <el-input
                  v-model.trim="formQueryCondition.actorCode.val"
                  class="queryItemStyle"
                  clearable
                  :placeholder="$t('Actor.queryLabel.placeholderCode')"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="7" :offset="1">
              <!-- 演员姓名 -->
              <el-form-item :label="$t('Actor.queryLabel.name')" :label-width="queryformLabelWidth">
                <el-input
                  v-model.trim="formQueryCondition.actorName.val"
                  class="queryItemStyle"
                  clearable
                  :placeholder="$t('Actor.queryLabel.placeholderName')"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="7" :offset="1">
              <!-- 姓名简拼 -->
              <el-form-item :label="$t('Actor.queryLabel.pName')" :label-width="queryformLabelWidth">
                <el-input
                  v-model.trim="formQueryCondition.actorPy.val"
                  class="queryItemStyle"
                  clearable
                  :placeholder="$t('Actor.queryLabel.placeholderPName')"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="7">
              <!-- 演员别名 -->
              <el-form-item :label="$t('Actor.queryLabel.byName')" :label-width="queryformLabelWidth">
                <el-input
                  v-model.trim="formQueryCondition.actorAlName.val"
                  class="queryItemStyle"
                  clearable
                  :placeholder="$t('Actor.queryLabel.placeholderByName')"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="7" :offset="1">
              <!-- 性别 -->
              <el-form-item :label="$t('actorQueryLabel.role.sex')" :label-width="queryformLabelWidth">
                <el-select
                  v-model="formQueryCondition.sex.val"
                  class="queryItemStyle"
                >
                  <el-option :label="$t('label.all')" value></el-option>
                  <el-option :value="drug.valueCode" :key="drug.valueCode" :label="drug.valueText"
                                    v-for="drug in gender"></el-option>
                  <!-- <el-option :label="$t('label.man')" value="Man"></el-option>
                  <el-option :label="$t('label.women')" value="Women"></el-option> -->
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="7" :offset="1">
              <!-- 英文名 -->
              <el-form-item :label="$t('Actor.queryLabel.enName')" :label-width="queryformLabelWidth">
                <el-input
                  v-model.trim="formQueryCondition.actorEnName.val"
                  class="queryItemStyle"
                  clearable
                  :placeholder="$t('Actor.queryLabel.placeholderEnName')"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>

          <!--事件按钮-->
         <el-row>
           <el-col :span="24">
              <div style="text-align:right">
                <!-- <el-form-item>
                  <el-button type="primary" @click="test()" >测试</el-button>
                </el-form-item> -->
                <el-form-item>
                  <el-button type="primary" @click="determine(temporary)" >{{ $t('btnText.confirmBtnText') }}</el-button>
                <!-- </el-form-item> -->
                <!--重置-->
                <!-- <el-form-item> -->
                    <el-button type="primary" @click="onReset('form')">{{ $t('shellAssets.btnText.resetBtnText') }}</el-button>
                <!-- </el-form-item> -->
                <!-- <el-form-item> -->
                  <el-button type="primary" @click="onQuery" icon="el-icon-search" :loading="loading" >{{ $t('btnText.queryBtnText') }}</el-button>
                </el-form-item>
              </div>
           </el-col>
         </el-row>
          <div style="text-align:left">
            <!--当前选择&nbsp;&nbsp;{{tableChecked.length}}&nbsp;&nbsp;条数据-->{{ $t('tagManage.label.haveChosen') }}
            <el-tag
            :key="actor.keyId"
            v-for="actor in temporary"
            size="medium"
            :disable-transitions="false">
            {{actor.actorName}}
          </el-tag>
            <!-- <span v-for="actor in tableChecked" :key="actor.keyId">{{actor.actorName+" "}}</span> -->
          </div>
        </el-form>
      </div>
      <div class="dataBox" ref="dataBox">
        <!--数据表格-->
        <!-- @selection-change="handleSelectionChange" -->
        <transition enter-active-class="animated zoomIn" leave-active-class="animated rotateOut">
          <el-table
            v-if="isInit"
            ref="singleTableList"
            :data="tableData"
            class="jySelectionAll"
            :height="tableHeight"
            @sort-change="sortChange"
            @select="handleSelectionChange"
            v-loading="loading"
            size="mini"
            style="width: 100%;"
            stripe="stripe"
            border="border"
          >
          <!-- :row-key="getRowKeys" -->
          <!-- :reserve-selection="true" -->
          <el-table-column type="selection" align="center"  width="50" fixed="left">
              </el-table-column>
            <el-table-column
              prop="actorCode"
              min-width="130"
              :label="$t('Actor.table.code')"
              sortable="custom"
              sort-by="actorCode"
            ></el-table-column>
            <el-table-column
              prop="actorName"
              min-width="110"
              :label="$t('Actor.table.name')"
              sortable="custom"
              sort-by="actorName"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              prop="actorPy"
              min-width="130"
              :label="$t('Actor.table.pName')"
              sortable="custom"
              sort-by="actorPy"
            ></el-table-column>
            <el-table-column
              prop="actorAlName"
              min-width="130"
              :label="$t('Actor.table.byName')"
              sortable="custom"
              sort-by="actorAlName"
            ></el-table-column>
            <el-table-column
              prop="approvalStatus"
              min-width="130"
              :label="$t('Actor.table.approvalStatus')"
              sortable="custom"
              sort-by="approvalStatus"
            ></el-table-column>
            <el-table-column
              prop="sex"
              min-width="110"
              :label="$t('Actor.table.sex')"
              sortable="custom"
              sort-by="sex"
            ></el-table-column>
            <!-- <el-table-column
              prop="nationality"
              min-width="110"
              :label="$t('actorTable.nationality')"
              sortable="custom"
              sort-by="nationality"
            ></el-table-column> -->
            <el-table-column
              prop="actorEnName"
              min-width="110"
              :label="$t('Actor.table.enName')"
              sortable="custom"
              sort-by="actorEnName"
            ></el-table-column>
          </el-table>
        </transition>
      </div>
    </div>
    <br>
    <div class="pageBox">
      <el-pagination
        @size-change="sizeChange"
        @current-change="currentPageChange"
        :current-page="pager.curPage"
        :page-sizes="pager.sizes"
        :page-size="pager.curSize"
        :background="true"
        layout="total, sizes, prev, pager, next, jumper"
        :total="pager.total"
      ></el-pagination>
    </div>


  </div>
</template>

<script>
import comBaseVue from "../../baseViewModel";

export default {
  mixins: [comBaseVue],
  name: "ActorTwo",
  props: {
    isNeedGoBack: Boolean,
    curRootAssets: Object,
    menuCode: String,
    datas:{
      opt: String,
      isClear: String,
      transmitData: null
    }
  },
  data() {
    return {
      imageUrl: '',
      // 是否正在提交中
      loading: false,
      //真正的实体类名称
      modelName: "com.ispr.iptv.entity.media.MediaActor",
      // 是否正在提交中
      loading: false,
      dataDisplay:[], //数据回显
      dataDisplayIsEnabled: true,
      isInit: false,
      isNonEditable: false,
      isShowChoose:false,
      tableData: [],
      gender: [],
      ApprovalStatus: [],
      isShowAuditForm: false,
      tableChecked:[],//被选中的记录数据-----对应“确认”传的参数值
      names:[],//选中的演员名称
      //编辑布局
      //标题
      titleSpan: 24,
      temporary: [],
      labelSpan: 3,
      dataSpan: 9,
      appDivStyle: {
        height: this.$store.getters.appHeight
      },
      // 查询条件
      formQueryCondition: {
        actorCode: {
          key: "actorCode",
          op: "LIKE", // 操作符
          val: "" // 查询的值
        },
        actorName: {
          key: "actorName",
          op: "LIKE", // 操作符
          val: "" // 查询的值
        },
        actorPy: {
          key: "actorPy",
          op: "LIKE", // 操作符
          val: "" // 查询的值
        },
        actorAlName: {
          key: "actorAlName",
          op: "LIKE", // 操作符
          val: "" // 查询的值
        },
        sex: {
          key: "sex",
          op: "=", // 操作符
          val: "" // 查询的值
        },
        actorEnName: {
          key: "actorEnName",
          op: "LIKE", // 操作符
          val: "" // 查询的值
        },
        isEnable: {
                key: 'isEnable',
                op: '=', // 操作符
                val: 'Available'
            },
        approvalStatus: {
                key: 'approvalStatus',
                op: '=', // 操作符
                val: 'ExaminationPassed'
            },
      },
      queryformLabelWidth: "75px",
      editformLabelWidth: "120px",
      editFormPosition: "right",
      count:0,
      // 分页对象
      pager: {
        curPage: 1,
        sizes: [20, 30, 50, 100, 200, 400],
        curSize: 20,
        total: 0
      },
      // 排序对象
      sort: {
        key: "keyId",
        dir: "Desc"
      },
      // 是否显示编辑面板
      isEditForm: false,
      isShowEditForm2: false,
      // 当前编辑面板执行的命令
      curCommand: "SaveNew",
      canEditCode: false,
      // 编辑面板绑定的对象
      editForm: {
        keyId: 0,
        version: 0,
        actorCode: "",
        actorName: "",
        actorPy: "",
        actorAlName: "",
        sex: "",
        actorEnName: "",
        actorLogo: "",
        actorBgPic: "",
        actorInformation: "",
        actorDesc: "",
      },
      editRules: {
        actorCode: [{required: true,message: this.$i18n.t("Actor.rules.code"),trigger: "blur"}],
        actorName: [{required: true,message: this.$i18n.t("Actor.rules.name"),trigger: "blur"}],
        sex: [{ required: true,message: this.$i18n.t("Actor.rules.sex"),trigger: "blur"}],
        actorPy: [{required: true,message: this.$i18n.t("Actor.rules.janeSpell"),trigger: "blur"}],
        // actorLogo: [{required: true,message: this.$i18n.t("Actor.rules.headPortrait"),trigger: "blur"}],
      },
      //审核面板绑定属性
      auditForm: {
        keyId: "",
        version: 0,
        assetVersion: "",
        reviewDataType: "",
        isEnable: "",
        approvalStatus: "",
        reviewDesc: "",
      },
      // 审核面板的验证规则
      auditRules: {
        reviewDesc: [{required: true,message: this.$i18n.t("assetsAudit.rules.auditSuggestion"),trigger: "blur"}],
      }
    };
  },
  methods: {
    // 新增
    onNew: function() {
      this.isEditForm = true;
      if (this.$refs["editForm"]) {
        this.$refs["editForm"].resetFields();
      }
      this.editForm.keyId = "";
      this.editForm.version = "";
      this.editForm.actorCode = "";
      this.editForm.actorName = "";
      this.editForm.actorPy = "";
      this.editForm.actorAlName = "";
      this.editForm.sex = "";
      this.editForm.actorEnName = "";
      this.editForm.actorLogo = "";
      this.editForm.actorBgPic = "";
      this.editForm.actorInformation = "";
      this.editForm.actorDesc = "";
      this.editForm.isEnable = "Available";
      this.editForm.approvalStatus = "PendingReview";
      this.curCommand = "SaveNewReturnPK";
      // this.canEditCode = false;
      this.isNonEditable = true;
    },

    determine: function(rows){
        var _this = this;
        _this.names = [];
          rows.forEach(element =>{
            _this.names.push(
                {"actorName":element.actorName,"actorId":element.keyId})
              })
            this.$emit("ShellAssets",_this.names,this.isShowChoose,this.datas.opt);
              // _this.names.forEach(i =>{
              //   alert(i.actorName)
              // })
            // this.$confirm(this.$i18n.t("message.confirmlogoffMessage"),
            //     this.$i18n.t("message.confirmTitle"), {
            //     confirmButtonText: this.$i18n.t("message.yes"),
            //     cancelButtonText: this.$i18n.t("message.cancel"),
            //     type: "warning",
            //     callback: function (action, instance) {
            //         if (action == "confirm") {
            //             rows.forEach(element =>{
            //                 _this.names.push(
            //                     {"actorName":element.actorName})
            //         })
            //         alert(names)
                    // var commandBody = _this.names;
                    //     _this.loading = true;
                    //     _this.procCommand("AssetManagementBatchDelete",//"ChangeIsEnabledState",
                    //             _this.modelName,
                    //             "N",
                    //             commandBody,
                    //             _this.submitFormCallback);
            //        }

            //    }
          //  });
    },
    // 查询按钮
    onQuery: function() {
      this.pager.curPage = 1;
      this.queryTable();
    },
    // 重置
    onReset: function() {
      if (this.$refs["form"]) {
        this.$refs["form"].resetFields();
      }
      this.formQueryCondition.actorCode.val = "";
      this.formQueryCondition.actorName.val = "";
      this.formQueryCondition.actorPy.val = "";
      this.formQueryCondition.actorAlName.val = "";
      this.formQueryCondition.sex.val = "";
      this.formQueryCondition.actorEnName.val = "";
      this.formQueryCondition.approvalStatus.val = "ExaminationPassed";

    },

    // 导出按钮
    onExport: function() {
      this.$message({
        message: this.$i18n.t("操作成功"),
        type: "success"
      });
    },
    //导入按钮
    onImport: function() {
      this.$message({
        message: this.$i18n.t("操作成功"),
        type: "success"
      });
    },
    //审核按钮
    // onAuditing: function() {
    //   this.$message({
    //             message: this.$i18n.t("操作成功" ),
    //             type: 'success'
    //             });
    // },
    onAuditing: function(index, row) {
      // this.isAuditInfoForm = true;
        this.auditForm.assetVersion = row.version;
        this.auditForm.reviewDesc = "";
        this.auditForm.reviewDataId= row.keyId,
        this.auditForm.reviewDataType= "ACTOR",
        this.auditForm.isEnable= "Available",
      // this.auditRules.auditSuggestion.message = "";
      this.isShowAuditForm = true;
    },
    //审核通过
    success: function() {
      this.auditForm.approvalStatus= "ExaminationPassed",
        //this.auditForm.opType= "ExaminationPassed",
        this.loading = true;
         this.procCommand("MediaAuditProc",
            "com.ispr.iptv.entity.media.MediaActor",
            "Default",
            {
                "keyId":this.auditForm.reviewDataId,
                "version":this.auditForm.assetVersion,
                "approvalStatus":this.auditForm.approvalStatus,
                "reviewHisEntity":this.auditForm
            },
            this.commonCallback);
    },
    //审核未通过
    submitFormForReject: function (formName) {
        var _this = this;
        this.auditForm.approvalStatus= "TheAuditFailed",
        this.$refs[formName].validate(function (valid) {
            if (valid) {
                _this.loading = true;
                _this.procCommand("MediaAuditProc",
                "com.ispr.iptv.entity.media.MediaActor",
                "Default",
                {
                    "keyId":_this.auditForm.reviewDataId,
                    "version":_this.auditForm.assetVersion,
                    "approvalStatus":_this.auditForm.approvalStatus,
                    "reviewHisEntity":_this.auditForm
                },
                _this.commonCallback);
            } else {
                return false;
            }
        });
    },
    commonCallback: function (isSuccess,json) {
        this.loading = false;
        this.isShowAuditForm = false;
        if(isSuccess){
            this.$message({
                message: this.$i18n.t("message.successTip"),//resource.message.successTip,
                type: 'success'
            });
            this.queryTable();
        }
        else
        {
            this.$message({
                message: json.msg,
                type: 'warning'
                });
        }
    },
    //详情按钮
    onDetails: function(index, row) {
      //dataAccess.queryDomainModelByKeyID(this, modelName, "Query", row.keyID, true, this.$options.methods.editCallback);
      this.queryModelByKeyID(
        this.modelName,
        row.keyId,
        "Query",
        this.onDetailsCallback
      );
    },

    onDetailsCallback: function(isSuccess, json) {
      if (isSuccess) {
        this.isShowEditForm2 = true;
        if (this.$refs["editForm"]) {
          this.$refs["editForm"].resetFields();
        }
        this.editForm.keyId = json.keyId;
        this.editForm.actorCode = json.actorCode;
        this.editForm.actorName = json.actorName;
        this.editForm.actorPy = json.actorPy;
        this.editForm.actorAlName = json.actorAlName;
        this.editForm.sex = json.sex;
        this.editForm.actorEnName = json.actorEnName;
        this.editForm.actorInformation = json.actorInformation;
        this.editForm.actorDesc = json.actorDesc;
        this.editForm.actorLogo = "1234";
        this.editForm.approvalStatus = "PendingReview";
        this.canEditCode = false;
      } else {
        this.$message({
          message: json.msg,
          type: "warning"
        });
      }
    },
    // // 提交编辑面板数据
    // submitForm2: function submitForm2(formName) {
    //   var _this = this;

    //   this.$refs[formName].validate(function(valid) {
    //     if (valid) {
    //       _this.loading = true;
    //       _this.procCommand(
    //         _this.curCommand,
    //         _this.modelName,
    //         "Default",
    //         _this.editForm,
    //         _this.submitForm2Callback
    //       );
    //     } else {
    //       return false;
    //     }
    //   });
    // },
    // // 执行命令后的回调函数
    // submitForm2Callback: function submitForm2Callback(isSuccess, json) {
    //   this.loading = false;
    //   if (isSuccess) {
    //     this.isShowEditForm2 = false;
    //     this.$message({
    //       message: this.$i18n.t("message.successTip"), //resource.message.successTip,
    //       type: "success"
    //     });
    //     this.queryTable();
    //   } else {
    //     this.$message({
    //       message: this.$i18n.t("errorCode." + json.reason),
    //       type: "warning"
    //     });
    //   }
    // },
    //提取图片按钮
    onGetPhoto: function() {
      this.$message({
        message: this.$i18n.t("操作成功"),
        type: "success"
      });
    },
    // 分页容量变化
    sizeChange: function(val) {
      this.pager.curPage = 1;
      this.pager.curSize = val;
      this.queryTable();
    },
    // 分页按钮
    currentPageChange: function(val) {

      this.pager.curPage = val;
      this.queryTable();
    },
    // 生成网格的序号
    indexCreate: function(index) {
      return (this.pager.curPage - 1) * this.pager.curSize + (index + 1);
    },

    // test(){

    // //   this.$refs.singleTableList.clearSelection();
    // //   setTimeout(() => {
    // // 　　 this.rowMultipleChecked();
    // //  　　}, 500)
    // this.$nextTick(function(){
    //       if(this.tableChecked.length !== 0){
    //           let _this = this;
    //           console.log('tableChecked==>',_this.tableChecked)
    //           // this.tableChecked.forEach(row => {
    //           //     _this.$refs.singleTableList.toggleRowSelection(row,true);
    //           //   })
    //
    //           if(this.dataDisplayIsEnabled){
    //             this.dataDisplay = this.tableChecked;
    //           }
    //           console.log('dataDisplay=>',this.dataDisplay)
    //           this.dataDisplay.forEach(row => {
    //              _this.$refs.singleTableList.toggleRowSelection(row,true);
    //           });
    //         }
    //       })

    // },
    // rowMultipleChecked(){
    //     this.$nextTick(function(){
    //       if(this.tableChecked.length !== 0){
    //           let _this = this;
    //           this.tableChecked.forEach(row => {
    //               _this.$refs.singleTableList.toggleRowSelection(row,true);
    //             })
    //         }
    //       })
    // },
    // getRowKeys(row) {

    // return row.keyId;
    // },
    transmitData:function(transmitData){
      // debugger
      this.temporary = JSON.parse(JSON.stringify(transmitData));;
      // console.log('this.datas.transmitDataLabel============>',this.datas.transmitDataLabel);
      // console.log('temporaryReception============>',this.temporaryReception);
    },
    // 勾选演员按钮
    handleSelectionChange(selection,val) {

         // 判断当前点击的是打钩还是取消打钩 true 则是打勾
        let isSelected = this.isExistRow(selection, val, 'keyId');
        // console.log('selection==>',selection);
        console.log('transmitData==>',this.temporary)
        // console.log('val==>',val)
        if(isSelected){
            // 勾选
            if(this.temporary !== undefined){
              if (!this.isExistRow(this.temporary, val, 'keyId')) {
                this.temporary.push(val);
              }
            }

        }else {
            // 取消勾选
            for (let i in this.temporary) {
              if (this.temporary[i].keyId === val.keyId) {
                this.temporary.splice(i, 1);
              }
            }
          }

      },
      // 判断 arrs数组中是否存在row 存在则返回true
    isExistRow: function isExistRow (arrs, row, field) {
      let flag = false;
      arrs.forEach(function (item) {
        if (row[field] === item[field]) {
          flag = true;
        }
      });
      return flag;
    },
     // 重置
    // onReset:function(){
    //     if (this.$refs['form']) {
    //         this.$refs['form'].resetFields();
    //     }

    //     this.formQueryCondition.keyId.val = "";
    //     this.formQueryCondition.assetCode.val = "";
    //     this.formQueryCondition.assetName.val = "";
    //     this.formQueryCondition.assetType.val = "";
    //     // this.formQueryCondition.sort.val = "";
    //     this.formQueryCondition.assetProvider.val = "";
    //     this.formQueryCondition.assetSource.val = "";
    //     this.formQueryCondition.tag.val = "";
    //     this.formQueryCondition.assetState.val = "";
    //     this.formQueryCondition.copyrightStartDate.val = "";
    //     this.formQueryCondition.copyrightEndDate.val = "";
    //     this.formQueryCondition.isEnable.val = "Available";
    // },
    // 排序回调函数
    sortChange: function(sortObj) {
      console.log(sortObj);
      this.pager.curPage = 1;
      this.sort.key = sortObj.column.sortBy;
      if (sortObj.order == "ascending") {
        this.sort.dir = "asc";
      } else {
        this.sort.dir = "desc";
      }
      this.queryTable();
    },

    // 编辑按钮单击事件
    onEdit: function(index, row) {
      //dataAccess.queryDomainModelByKeyID(this, modelName, "Query", row.keyID, true, this.$options.methods.editCallback);
      this.queryModelByKeyID(
        this.modelName,
        row.keyId,
        "Query",
        this.editCallback
      );
    },
    // 编辑按钮回调事件
    editCallback: function(isSuccess, json) {
      if (isSuccess) {
        this.curCommand = "PartialUpdateProc";
        this.isEditForm = true;
        if (this.$refs["editForm"]) {
          this.$refs["editForm"].resetFields();
        }
        // this.editForm = json;
        // this.canEditCode = true;
        this.editForm.keyId = json.keyId;
        this.editForm.actorCode = json.actorCode;
        this.editForm.actorName = json.actorName;
        this.editForm.actorPy = json.actorPy;
        this.editForm.actorAlName = json.actorAlName;
        this.editForm.sex = json.sex;
        this.editForm.actorEnName = json.actorEnName;
        this.editForm.actorInformation = json.actorInformation;
        this.editForm.actorDesc = json.actorDesc;
        this.editForm.actorLogo = "1234";
        this.editForm.approvalStatus = "PendingReview";
        this.editForm.version = json.version;

        this.isNonEditable = true;
      } else {
        this.$message({
          message: json.msg,
          type: "warning"
        });
      }
    },

    // 删除按钮
    deleteRow: function(index, row) {
      var _this = this;
      this.$confirm(
        this.$i18n.t("message.confirmDelMessage"),
        this.$i18n.t("message.confirmTitle"),
        {
          confirmButtonText: this.$i18n.t("message.yes"),
          cancelButtonText: this.$i18n.t("message.cancel"),
          type: "warning",
          callback: function(action, instance) {
            if (action == "confirm") {
              console.log(_this);
              console.log(row);
              var commandBody = {
                data: [{ keyID: row.keyID, ver: row.version }],
                count: 1
              };
              _this.loading = true;
              _this.procCommand(
                "DelProc",
                _this.modelName,
                "N",
                commandBody,
                _this.submitFormCallback
              );
            }
          }
        }
      );
    },
    // 查询网格数据
    queryTable: function() {

      this.loading = true;
      this.queryModel(
        this.modelName,
        "Query",
        this.formQueryCondition,
        this.pager,
        this.sort,
        this.setTableData
      );
    },
     // 查询网格数据成功后的回调
        setTableData: function(isSuccess,json) {

            // if(this.datas.isClear === "true"){
              // this.tableChecked = [];
              // this.$refs.singleTableList.clearSelection();
              // }

            this.currentResCode = '';
            this.loading = false;
            try{
                if (isSuccess) {
                    //alert(JSON.stringify(json));
                    this.pager.total = json.total;
                    this.tableData = [];
                    this.datas.isClear = "false";
                    for (var i = 0; i < json.list.length; i++) {
                        this.tableData.push(json.list[i]);
                    }
                    // this.datas.isClear = false;  dataDisplay
                    // tableChecked

                    // console.log('this.datas.transmitData==>',this.temporary)
                    // this.temporary = JSON.parse(JSON.stringify(this.datas.transmitData));;
                    if(this.temporary.length > 0){
                       let _this = this;
                        // dataDisplay 临时数据存储  tableChecked
                        this.dataDisplay = [];
                        // tableData存储全部数据
                        // tableChecked为父组件传递过来的数据
                        for(let i=0;i<this.tableData.length;i++){
                          for(let n = 0;n<this.temporary.length;n++){
                            if(this.tableData[i].keyId === this.temporary[n].keyId){
                              // this.dataDisplayIsEnabled = false;
                              this.dataDisplay.push(this.tableData[i]);
                            }
                          }
                        }
                        if(this.dataDisplay.length > 0){
                          console.log('this.dataDisplay数据回显==>',this.dataDisplay)
                          this.$nextTick(function(){
                            for(let i = 0;i<this.dataDisplay.length;i++){
                              this.$refs.singleTableList.toggleRowSelection(this.dataDisplay[i],true);
                            }
                          })
                        }
                    }


                }
                else {
                    this.$message.error(json.msg);
                }
            }
            catch(e){
                alert(e);
            }
        },
    // 提交编辑面板数据
    submitEditForm: function (formName) {
      var _this = this;

      this.$refs[formName].validate(function(valid) {
        if (valid) {
          _this.loading = true;
          _this.procCommand(
            _this.curCommand,
            _this.modelName,
            "Default",
            _this.editForm,
            _this.submitFormCallback
          );
        } else {
          return false;
        }
      });
    },
    // 执行命令后的回调函数
    submitFormCallback: function (isSuccess, json) {
      this.loading = false;
      if (isSuccess) {
        this.isEditForm = false;
        this.$message({
          message: this.$i18n.t("message.successTip"), //resource.message.successTip,
          type: "success"
        });
        this.queryTable();
      } else {
        this.$message({
          message: json.msg,
          type: "warning"
        });
      }
    },

      //回退事件
      back: function(isSuccess, json) {
        //this.$router.go(-1);//后退
        this.$parent.setCurrentComponent("goBack", null);
      },
      // 为性别下拉框赋值
    findGender: function() {
        this.findByTypeCode("10003",this.setGender)
    },
    // 查询性别下拉框数据成功后的回调
    setGender: function(isSuccess,json) {
        try{
            if (isSuccess) {
                this.gender = [];
                for (var i = 0; i < json.data.length; i++) {
                    this.gender.push(json.data[i]);
                }
            }
            else {
                this.$message.error(json.msg);
            }
        }
        catch(e){
            alert(e);
        }
    },
        // 为资产状态下拉框赋值
    findApprovalStatus: function() {
        this.findByTypeCode("10007",this.setApprovalStatus)
    },
    // 查询资产状态下拉框数据成功后的回调
    setApprovalStatus: function(isSuccess,json) {
        try{
            if (isSuccess) {
                this.ApprovalStatus = [];
                for (var i = 0; i < json.data.length; i++) {
                    this.ApprovalStatus.push(json.data[i]);
                }
            }
            else {
                this.$message.error(json.msg);
            }
        }
        catch(e){
            alert(e);
        }
    },
      initTable:function(){
          this.tableHeight = this.$refs.context.offsetHeight - this.$refs.queryBox.offsetHeight;
          this.isInit = true;
      },

      handleAvatarSuccess(res, file) {
        this.imageUrl = URL.createObjectURL(file.raw);
      },
      beforeAvatarUpload(file) {
        const isJPG = file.type === 'image/jpeg';
        const isLt2M = file.size / 1024 / 1024 < 2;

        if (!isJPG) {
          this.$message.error('上传头像图片只能是 JPG 格式!');
        }
        if (!isLt2M) {
          this.$message.error('上传头像图片大小不能超过 2MB!');
        }
        return isJPG && isLt2M;
      },


  },
  computed: {
      dDataSpan:function(){
          return 24 - this.labelSpan;
      }
  },
  mounted: function mounted() {
      this.transmitData(this.datas.transmitData);
      this.findGender();
      this.findApprovalStatus();
      this.onQuery();
      window.setTimeout(this.initTable,100);
  }
};
</script>
<style>
/* 隐藏网格的全选按钮 */
.jySelectionAll >.el-table__fixed>.el-table__fixed-header-wrapper>.el-table__header> thead >tr>th >.cell>label {
  display: none;
}
/* 隐藏网格的全选按钮 */
.jySelectionAll >.el-table__header-wrapper>.el-table__header> thead >tr>th >.cell >label {
  display: none !important;
}
</style>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.main {
  height: 100%;
  width: 100%;
  font-size: 14px;
  color: #333333;
  font-family: "Microsoft YaHei";
}
.datarow {
  border: 1px solid #eeeeee;
  padding: 0px 0px 0px 0px;
  margin-bottom: 0px;
  &:last-child {
    margin-bottom: 0;
  }
}

.titlecol {
  font-weight: bold;
}

.labcol {
  padding: 3px 3px 3px 5px;
  border-radius: 4px;
  font-size: 14px;
  text-align: right;
  border-right: 1px solid #eeeeee;
}

.datacol {
  padding: 3px 3px 3px 3px;
  border-radius: 0px;
  text-align: left;

  vertical-align: middle;
  border-right: 1px solid #eeeeee;
}

.bgrow {
  background-color: #d4f1ff;
}

.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }



</style>

